<template>
  <div class="staking-stats">
    <div class="stats-grid">
      <!-- NEAR Protocol 스테이킹 수량 (质押本金) -->
      <div class="stat-card">
        <div class="stat-header">
          <Icon icon="mdi:lock" class="stat-icon staked" />
          <h3 class="stat-title">{{ $t('pages.staking.nearProtocolStaked') }}</h3>
        </div>
        <div class="stat-content">
          <div class="stat-value">
            <span class="amount">{{ formatTokenAmount(stakedNear, '', 2) }}</span>
            <span class="unit">{{ $t('pages.staking.nearToken') }}</span>
          </div>
          <div class="stat-subtitle">{{ $t('pages.staking.stakedAmount') }}</div>
        </div>
      </div>

      <!-- 일일 스테이킹 보상금액 -->
      <div class="stat-card daily-reward">
        <div class="stat-header">
          <Icon icon="mdi:gift" class="stat-icon reward" />
          <h3 class="stat-title">{{ $t('pages.staking.dailyStakingReward') }}</h3>
        </div>
        <div class="stat-content">
          <div class="stat-value primary">
            <span class="amount">{{ formatTokenAmount(dailyRewardNear, '', 4) }}</span>
            <span class="unit">{{ $t('pages.staking.nearToken') }}</span>
          </div>
          <div class="stat-subvalue">{{ formatKRW(dailyRewardKRW) }}</div>
          <div class="stat-subtitle">{{ $t('pages.staking.todayStakingProfit') }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Icon } from '@iconify/vue'
import { formatKRW, formatTokenAmount } from '@/utils/currency'

interface Props {
  stakedNear: number
  dailyRewardNear: number
  dailyRewardKRW: number
}

withDefaults(defineProps<Props>(), {
  stakedNear: 0,
  dailyRewardNear: 0,
  dailyRewardKRW: 0
})
</script>

<style scoped lang="scss">
.staking-stats {
  margin-bottom: 32px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border: 1px solid #f1f5f9;
  transition: all 0.3s ease;

  &:hover {
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
  }

  &.daily-reward {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  }
}

.stat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;

  &.locked {
    color: #ef4444;
  }

  &.staked {
    color: #10b981;
  }

  &.reward {
    color: #f59e0b;
  }
}

.stat-title {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.stat-content {
  .stat-value {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;

    &.primary {
      .amount {
        font-size: 2rem;
      }
    }

    .amount {
      font-size: 2rem;
      font-weight: 700;
      color: #1a202c;
    }

    .unit {
      font-size: 1rem;
      font-weight: 500;
      color: #64748b;
    }
  }

  .stat-subvalue {
    font-size: 1rem;
    color: #475569;
    margin-bottom: 6px;
  }

  .stat-subtitle {
    font-size: 0.875rem;
    color: #64748b;
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .stat-card {
    padding: 20px;
  }

  .stat-content .stat-value .amount {
    font-size: 1.75rem;
  }
}

@media (max-width: 480px) {
  .stat-card {
    padding: 16px;
  }

  .stat-content .stat-value .amount {
    font-size: 1.5rem;
  }
}
</style>
